from django import template
from forum.models import Post

register = template.Library()

@register.simple_tag
def get_latest_posts(limit=4):
    return Post.objects.order_by('-created_at')[:limit]